package com.aistar.service.impl;

import com.aistar.mapper.ProgramCommentMapper;
import com.aistar.pojo.ProgramComment;
import com.aistar.service.ProgramCommentService;
import com.aistar.util.ServerResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class ProgramCommentServiceImpl implements ProgramCommentService {
    private final ProgramCommentMapper programCommentMapper;

    @Autowired
    public ProgramCommentServiceImpl(ProgramCommentMapper programCommentMapper) {
        this.programCommentMapper = programCommentMapper;
    }

    @Override
    public ServerResponse add(ProgramComment programComment) {
        programComment.setProgramCommentTime(new Date());
        int rows = programCommentMapper.insertSelective(programComment);
        if (rows > 0)
            return ServerResponse.addSuccess();
        return ServerResponse.addFailed();
    }
}
